package servlets;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import Impl.MasterDaoMySQLImpl;
import entitys.TopicWork;
import entitys.newsWork;

public class GetNewsTitle extends HttpServlet {


	public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		this.doPost(request, response);

	}


	public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
			
		
			PrintWriter out = response.getWriter();
//			request.setCharacterEncoding("text/html charset=utf-8");
			MasterDaoMySQLImpl mySQLImpl = new MasterDaoMySQLImpl();
			newsWork news = new newsWork();
			
			TopicWork topic = new TopicWork();
			List<Map<String, Object>> queryYLList = mySQLImpl.queryNewsTic();
			System.out.println(queryYLList.get(0).toString());
			
			request.setAttribute("list", queryYLList);
			request.getRequestDispatcher("TextNews.jsp").forward(request, response);
			
	}

}
